WebWorker
class WebWorker
A Web Worker that runs a self-contained JavaScript job off the main thread on Kotlin/Wasm (wasmJs).
The API is identical to the Kotlin/JS WebWorker. The worker is created at runtime from a Blob URL rather than a separate script file. The job runs in the Worker scope with no access to the Kotlin module. Pass everything it needs through the payload String and JSON-encode it for structure. jobJs is a JavaScript function expression (payload) => result, synchronous or asynchronous.
Each reply carries a correlation id. A reply to a cancelled call is dropped instead of being delivered to the next caller, so call is safe to cancel. Wrap call in withTimeout to apply a deadline.